import LoginView from '../views/LoginView.vue'
import HomeView from '../views/HomeView.vue'
import { createRouter, createWebHashHistory } from 'vue-router'
import SearchView from '@/views/SearchView.vue'
import DetailView from '@/views/DetailView.vue'

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        // {
        //     path: '/',
        //     redirect: '/home' // 如果访问的是 localhost:5173/#/ => localhost:5173/#/home
        // },
        {
            path: '/login',
            component: LoginView
        },
        {
            path: '/home',
            component: HomeView
        },
        {
            path:'/search',
            component: SearchView
        },
        {
            path:'/detail/:name',
            component:DetailView
        }
    ]
})

export default router